
package br.com.ltn4java.transformation;

import java.util.ArrayList;
import java.util.List;

/**
 *The class was create to transform a int type variable to char type variable 
 * Miguellima@aljug.com.br
 * Create in August, 05, 2011
 * Criado em 05 de Agosto de 2011<br/>
 * @author miguel
 */
public class NumberForLetter {
    
    /**
     * 
     * @param number que é um número inteiro para ser transformado em um variável tipo char
     * @return letter uma variavel tipo char.
     * 
     * Example: int x = 1
     * So the result is 'A'
     */
    
    
    
    public char number4Letter(int number) {
        char letter = 0;
        if (number == 1) {
            letter = 'A';
        }
        if (number == 2) {
            letter = 'B';
        }
        if (number == 3) {
            letter = 'C';
        }
        if (number == 4) {
            letter = 'D';
        }
        if (number == 5) {
            letter = 'E';
        }
        if (number == 6) {
            letter = 'F';
        }
        if (number == 7) {
            letter = 'G';
        }
        if (number == 8) {
            letter = 'H';
        }
        if (number == 9) {
            letter = 'I';
        }
        if (number == 10) {
            letter = 'J';
        }
        if (number == 11) {
            letter = 'K';
        }
        if (number == 12) {
            letter = 'L';
        }
        if (number == 13) {
            letter = 'M';
        }
        if (number == 14) {
            letter = 'N';
        }
        if (number == 15) {
            letter = 'O';
        }
        if (number == 16) {
            letter = 'P';
        }
        if (number == 17) {
            letter = 'Q';
        }
        if (number == 18) {
            letter = 'R';
        }
        if (number == 19) {
            letter = 'S';
        }
        if (number == 20) {
            letter = 'T';
        }
        if (number == 21) {
            letter = 'U';
        }
        if (number == 22) {
            letter = 'V';
        }
        if (number == 23) {
            letter = 'W';
        }
        if (number == 24) {
            letter = 'X';
        }
        if (number == 25) {
            letter = 'Y';
        }
        if (number == 26) {
            letter = 'Z';
        }


        return letter;
    }
    
    public List takeNumberByNumber(String Number) {
        List Numeros = new ArrayList();
        String number[] = Number.split(" ");
        System.out.println(number.length);

        for (int i = 0; i < number.length; i++) {

            if (number[i].equals("1")) {
                number[i] = "A";
                Numeros.add(number[i]);
            }
            if (number[i].equals("2")) {
                number[i] = "B";
                Numeros.add(number[i]);
            }
            if (number[i].equals("3")) {
                number[i] = "C";
                Numeros.add(number[i]);
            }
            if (number[i].equals("4")) {
                number[i] = "D";
                Numeros.add(number[i]);
            }
            if (number[i].equals("5")) {
                number[i] = "E";
                Numeros.add(number[i]);
            }
            if (number[i].equals("6")) {
                number[i] = "F";
                Numeros.add(number[i]);
            }

            if (number[i].equals("7")) {
                number[i] = "G";
                Numeros.add(number[i]);
            }
            if (number[i].equals("8")) {
                number[i] = "H";
                Numeros.add(number[i]);
            }
            if (number[i].equals("9")) {
                number[i] = "I";
                Numeros.add(number[i]);
            }
            if (number[i].equals("10")) {
                number[i] = "J";
                Numeros.add(number[i]);
            }
            if (number[i].equals("11")) {
                number[i] = "K";
                Numeros.add(number[i]);
            }
            if (number[i].equals("12")) {
                number[i] = "L";
                Numeros.add(number[i]);
            }
            if (number[i].equals("13")) {
                number[i] = "M";
                Numeros.add(number[i]);
            }
            if (number[i].equals("14")) {
                number[i] = "N";
                Numeros.add(number[i]);
            }
            if (number[i].equals("15")) {
                number[i] = "O";
                Numeros.add(number[i]);
            }if (number[i].equals("16")) {
                number[i] = "P";
                Numeros.add(number[i]);
            }if (number[i].equals("17")) {
                number[i] = "Q";
                Numeros.add(number[i]);
            }if (number[i].equals("18")) {
                number[i] = "R";
                Numeros.add(number[i]);
            }if (number[i].equals("19")) {
                number[i] = "S";
                Numeros.add(number[i]);
            }if (number[i].equals("20")) {
                number[i] = "T";
                Numeros.add(number[i]);
            }if (number[i].equals("21")) {
                number[i] = "U";
                Numeros.add(number[i]);
            }if (number[i].equals("22")) {
                number[i] = "V";
                Numeros.add(number[i]);
            }if (number[i].equals("23")) {
                number[i] = "W";
                Numeros.add(number[i]);
            }if (number[i].equals("24")) {
                number[i] = "X";
                Numeros.add(number[i]);
            }if (number[i].equals("25")) {
                number[i] = "Y";
                Numeros.add(number[i]);
            }if (number[i].equals("26")) {
                number[i] = "Z";
                Numeros.add(number[i]);
            }
            System.out.print(" " + number[i]);
        }
        return Numeros;
    }
    
    public List takeNumberByNumberWhitList(List number) {

        for (int i = 0; i < number.size(); i++) {
           String numbers = number.toString();
           String numb [] = numbers.split(" ");
            
            if (numb[i].equals("1")) {
                numb[i] = "A";
                number.add(numb[i]);
            }
            if (numb[i].equals("2")) {
                numb[i] = "B";
                number.add(numb[i]);
            }
            if (numb[i].equals("3")) {
                numb[i] = "C";
                number.add(numb[i]);
            }
            if (numb[i].equals("4")) {
                numb[i] = "D";
                number.add(numb[i]);
            }
            if (numb[i].equals("5")) {
                numb[i] = "E";
                number.add(numb[i]);
            }
            if (numb[i].equals("6")) {
                numb[i] = "F";
                number.add(numb[i]);
            }

            if (numb[i].equals("7")) {
                numb[i] = "G";
                number.add(numb[i]);
            }
            if (numb[i].equals("8")) {
                numb[i] = "H";
                number.add(numb[i]);
            }
            if (numb[i].equals("9")) {
                numb[i] = "I";
                number.add(numb[i]);
            }
            if (numb[i].equals("10")) {
                numb[i] = "J";
                number.add(numb[i]);
            }
            if (numb[i].equals("11")) {
                numb[i] = "K";
                number.add(numb[i]);
            }
            if (numb[i].equals("12")) {
                numb[i] = "L";
                number.add(numb[i]);
            }
            if (numb[i].equals("13")) {
                numb[i] = "M";
                number.add(numb[i]);
            }
            if (numb[i].equals("14")) {
                numb[i] = "N";
                number.add(numb[i]);
            }
            if (numb[i].equals("15")) {
                numb[i] = "O";
                number.add(numb[i]);
            }
        }
        return number;
    }
}